package com.example.xwcommon.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.xwcommon.entity.Comment;
import com.example.xwcommon.service.fallback.FallBackCommentServiceImpl;
import com.example.xwcommon.vo.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient(value="xw-comment",fallback = FallBackCommentServiceImpl.class)
public interface CommentService {
    //添加评论
    @GetMapping("/cm/add")
    public Response<Comment> addComment(@RequestParam("wbid") Integer wbid, @RequestParam("content")String content
            , @RequestParam("userloginname")String userloginname);
    //分页查询某篇微博的所有评论
    @GetMapping("/cm/findbywb")
    Response<Page<Comment>> showListByWeibo(@RequestParam("wbid")Integer wbid, @RequestParam("pagenum")Integer pageNum
            , @RequestParam("pagesize")Integer pageSize,@RequestParam("state")Integer state);

    //分页查询某人发表过的评论
    @GetMapping("/cm/findbyuser")
    Response<Page<Comment>> showListByUser(@RequestParam("userloginname")String userloginname
            , @RequestParam("pagenum")Integer pageNum, @RequestParam("pagesize")Integer pageSize, @RequestParam("state")Integer state);
    //删除评论
    @GetMapping("/cm/del")
    Response<Integer> removeComment(@RequestParam("cmid")Integer cmid);

    //更新评论状态
    @RequestMapping("/cm/updatestate")
    Response<Comment> updateState(@RequestParam("cmid")Integer cmId, @RequestParam("state")Integer state);
}
